package com.atstudy.headline.web.admin.service.impl;

import com.atstudy.headline.entity.AdCreatives;
import com.atstudy.headline.web.admin.mapper.AdCreativesMapper;
import com.atstudy.headline.web.admin.service.AdCreativesService;
import com.atstudy.headline.web.admin.vo.ad.AdCreativeVo;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author A
* @description 针对表【ad_creatives(广告创意表)】的数据库操作Service实现
* @createDate 2025-06-12 13:55:56
*/
@Service
public class AdCreativesServiceImpl extends ServiceImpl<AdCreativesMapper, AdCreatives>
    implements AdCreativesService {

    @Override
    public IPage<AdCreatives> pageInfoByAdCreatives(IPage<AdCreatives> page, AdCreativeVo adCreativeVo) {
        return baseMapper.pageInfoByAdCreatives(page,adCreativeVo);
    }

    public void deleteByCampaignIds(List<Integer> campaignIds) {
        QueryWrapper<AdCreatives> queryWrapper = new QueryWrapper<>();
        queryWrapper.in("campaign_id", campaignIds);
        baseMapper.delete(queryWrapper);
    }

    @Override
    public void deleteByCampaignId(Integer campaignId) {
        QueryWrapper<AdCreatives> wrapper = new QueryWrapper<>();
        wrapper.eq("campaign_id", campaignId);
        baseMapper.delete(wrapper);
    }
}




